package google.sites.view.menus.sites;

import dev.tools.view.dialogs.FormDialog;
import google.sites.model.commands.site.CopySite;
import google.sites.view.View;

import javax.swing.*;

/**
 * Created with IntelliJ IDEA.
 * User: Nuno
 * Date: 01-10-2013
 * Time: 17:14
 */
public class SitesCopyDialog extends FormDialog<CopySite> {
    private final JTextField titleTextField;
    private final JTextArea summaryTextArea;
    private final JTextField sourceHrefTextField;

    public SitesCopyDialog() {
        super(View.INSTANCE, new CopySite());
        titleTextField = addField("Title", new JTextField());
        summaryTextArea = addField("Summary", new JTextArea());
        sourceHrefTextField = addField("Source HREF", new JTextField());
    }

    @Override
    protected void onExecuting() {
        command
                .setTitle(titleTextField.getText())
                .setSummary(summaryTextArea.getText())
                .setSourceHref(sourceHrefTextField.getText());
    }
}
